import { app, ipcMain, Menu, Tray } from 'electron'
import { createMainWindow } from './main'
import { createImWindow } from './im'

let mainTray = null

export function createMainTray() {

    mainTray = new Tray("./static/32.png")
    const contextMenu = Menu.buildFromTemplate([
        { label: '进入系统', type: 'normal', click: inSystem },
        { label: '即时通讯', type: 'normal', click: inIm },
        { label: '个人设置', type: 'normal' },
        { label: '注销', type: 'normal' },
        { label: '退出', type: 'normal', click: exitSystem }
    ])
    mainTray.setToolTip('This is my application.')
    mainTray.setContextMenu(contextMenu)
    
}

function inSystem() {
    createMainWindow()
}

function inIm() {
    createImWindow()
}


function exitSystem() {
    app.quit()
}